package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsUserMapper;
import com.qf.pojo.DtsUser;
import com.qf.service.UserService;
import com.qf.vo.DayStatis;
import com.qf.vo.UserRowsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService{

    @Autowired
    private DtsUserMapper dtsUserMapper;
    @Override
    public Integer userCount() {
        QueryWrapper<DtsUser> queryWrapper = new QueryWrapper();
        queryWrapper.eq("deleted", 0);
        Integer count = dtsUserMapper.selectCount(queryWrapper);
        return count;
    }

    @Override
    public List<DayStatis> recentCount(Integer daysAgo) {
        List<DayStatis> list = dtsUserMapper.statisIncrCnt(daysAgo);
        return list;
    }

    @Override
    public DtsUser findByUid(Integer uid) {
        DtsUser dtsUser = dtsUserMapper.selectById(uid);
        return dtsUser;
    }

    @Override
    public List<UserRowsVo> statisUsers() {
        List<UserRowsVo> list = dtsUserMapper.statisUsers();
        return list;
    }


}
